/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entityBeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author allankv
 */
@Entity
@Table(name = "specimen")
@NamedQueries({
    @NamedQuery(name = "Specimen.findAll", query = "SELECT s FROM Specimen s"),
    //@NamedQuery(name = "Specimen.findByGui", query = "SELECT s FROM Specimen as s Left Join fetch s.Recordlevelelement as rWhere r.globaluniqueidentifier = :gui"),
    @NamedQuery(name = "Specimen.findByIdspecimen", query = "SELECT s FROM Specimen s WHERE s.idspecimen = :idspecimen")})

public class Specimen implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idspecimen")
    private Integer idspecimen;
    @JoinColumn(name = "idtaxonomicelement", referencedColumnName = "idtaxonomicelement")
    @ManyToOne(fetch = FetchType.LAZY,cascade = {CascadeType.PERSIST,CascadeType.MERGE })
    private Taxonomicelement taxonomicelement;
    @JoinColumn(name = "idrecordlevelelement", referencedColumnName = "idrecordlevelelement")
    @ManyToOne(fetch = FetchType.LAZY,cascade = {CascadeType.PERSIST,CascadeType.MERGE })
    private Recordlevelelement recordlevelelement;
    @JoinColumn(name = "idoccurrenceelement", referencedColumnName = "idoccurrenceelement")
    @ManyToOne(fetch = FetchType.LAZY,cascade = {CascadeType.PERSIST,CascadeType.MERGE })
    private Occurrenceelement occurrenceelement;
    @JoinColumn(name = "idmonitoring", referencedColumnName = "idmonitoring")
    @ManyToOne(fetch = FetchType.LAZY,cascade = {CascadeType.PERSIST,CascadeType.MERGE })
    private Monitoring monitoring;
    @JoinColumn(name = "idlocalityelement", referencedColumnName = "idlocalityelement")
    @ManyToOne(fetch = FetchType.LAZY,cascade = {CascadeType.PERSIST,CascadeType.MERGE })
    private Localityelement localityelement;
    @JoinColumn(name = "ididentificationelement", referencedColumnName = "ididentificationelement")
    @ManyToOne(fetch = FetchType.LAZY,cascade = {CascadeType.PERSIST,CascadeType.MERGE })
    private Identificationelement identificationelement;
    @JoinColumn(name = "idgeospatialelement", referencedColumnName = "idgeospatialelement")
    @ManyToOne(fetch = FetchType.LAZY,cascade = {CascadeType.PERSIST,CascadeType.MERGE })
    private Geospatialelement geospatialelement;
    @JoinColumn(name = "ideventelement", referencedColumnName = "ideventelement")
    @ManyToOne(fetch = FetchType.LAZY,cascade = {CascadeType.PERSIST,CascadeType.MERGE })
    private Eventelement eventelement;
    @JoinColumn(name = "idcuratorialelement", referencedColumnName = "idcuratorialelement")
    @ManyToOne(fetch = FetchType.LAZY,cascade = {CascadeType.PERSIST,CascadeType.MERGE })
    private Curatorialelement curatorialelement;
    @OneToMany(mappedBy = "specimen", fetch = FetchType.LAZY)
    private List<Interaction> interactionList;
    @OneToMany(mappedBy = "specimen1", fetch = FetchType.LAZY)
    private List<Interaction> interactionList1;

    public Specimen() {
    }

    public Specimen(Integer idspecimen) {
        this.idspecimen = idspecimen;
    }

    public Integer getIdspecimen() {
        return idspecimen;
    }

    public void setIdspecimen(Integer idspecimen) {
        this.idspecimen = idspecimen;
    }

    public Taxonomicelement getTaxonomicelement() {
        return taxonomicelement==null?new Taxonomicelement():taxonomicelement;
    }

    public void setTaxonomicelement(Taxonomicelement taxonomicelement) {
        this.taxonomicelement = taxonomicelement;
    }

    public Recordlevelelement getRecordlevelelement() {
        return recordlevelelement==null?new Recordlevelelement():recordlevelelement;
    }

    public void setRecordlevelelement(Recordlevelelement recordlevelelement) {
        this.recordlevelelement = recordlevelelement;
    }

    public Occurrenceelement getOccurrenceelement() {
        return occurrenceelement==null?new Occurrenceelement():occurrenceelement;
    }

    public void setOccurrenceelement(Occurrenceelement occurrenceelement) {
        this.occurrenceelement = occurrenceelement;
    }

    public Monitoring getMonitoring() {
        return monitoring;
    }

    public void setMonitoring(Monitoring monitoring) {
        this.monitoring = monitoring;
    }

    public Localityelement getLocalityelement() {
        return localityelement==null?new Localityelement():localityelement;
    }

    public void setLocalityelement(Localityelement localityelement) {
        this.localityelement = localityelement;
    }

    public Identificationelement getIdentificationelement() {
        return identificationelement==null?new Identificationelement():identificationelement;
    }

    public void setIdentificationelement(Identificationelement identificationelement) {
        this.identificationelement = identificationelement;
    }

    public Geospatialelement getGeospatialelement() {
        return geospatialelement==null?new Geospatialelement():geospatialelement;
    }

    public void setGeospatialelement(Geospatialelement geospatialelement) {
        this.geospatialelement = geospatialelement;
    }

    public Eventelement getEventelement() {
        return eventelement==null?new Eventelement():eventelement;
    }

    public void setEventelement(Eventelement eventelement) {
        this.eventelement = eventelement;
    }

    public Curatorialelement getCuratorialelement() {
        return curatorialelement==null?new Curatorialelement():curatorialelement;
    }

    public void setCuratorialelement(Curatorialelement curatorialelement) {
        this.curatorialelement = curatorialelement;
    }

    public List<Interaction> getInteractionList() {
        return interactionList;
    }

    public void setInteractionList(List<Interaction> interactionList) {
        this.interactionList = interactionList;
    }

    public List<Interaction> getInteractionList1() {
        return interactionList1;
    }

    public void setInteractionList1(List<Interaction> interactionList1) {
        this.interactionList1 = interactionList1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idspecimen != null ? idspecimen.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Specimen)) {
            return false;
        }
        Specimen other = (Specimen) object;
        if ((this.idspecimen == null && other.idspecimen != null) || (this.idspecimen != null && !this.idspecimen.equals(other.idspecimen))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entityBeans.Specimen[idspecimen=" + idspecimen + "]";
    }

}
